
class CommonMethod:

    def __init__(self, driver):
        self.driver = driver


    def  findElement(self,mode,route):
        # 封装好的八大定位方法

        if mode == "ID":
            return self.driver.find_element_by_id(route)
        elif mode == "NAME":
            return self.driver.find_element_by_name(route)
        elif mode == "CLASS_NAME":
            return self.driver.find_element_by_class_name(route)
        elif mode == "LINK_TEXT":
            return self.driver.find_element_by_link_text(route)
        elif mode == "PARTIAL_LINK_TEXT":
            return self.driver.find_element_by_partial_link_text(route)
        elif mode == "XPATH":
            return self.driver.find_element_by_xpath(route)
        elif mode == "CSS_SELECTOR":
            return self.driver.find_element_by_css_selector(route)
        elif mode == "TAG_NAME":
            return self.driver.find_element_by_tag_name(route)



